<script setup lang="ts">
import { ref } from 'vue';
import TheWelcome from '../components/TheWelcome.vue'

let name =ref<string>('父组件传递的值')
const getName = ref()
 const getItem = (item)=>{
  getName.value =item
 }

 //ref名称必须与绑定的名称相同
 const welcome =ref<InstanceType<typeof TheWelcome>>()
 const exButton = ()=>{
   console.log(welcome.value?.name);
 }

</script>

<template>
  <main>
    <div>父组件 {{ getName }}</div>
    <div> <button @click="exButton"> 传参</button></div>
    <TheWelcome ref="welcome" :title="name" @on-send="getItem"/>
  </main>
</template>
